package cn.power.win.win_power.utils;



import android.content.SharedPreferences;
import android.preference.PreferenceManager;

import java.io.Serializable;
import java.util.List;

import cn.power.win.win_power.MyApp;

public class SharedPreferencesUtil {

    private static SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(MyApp.getAppContext());


    //根据传入的键得到字符串值
    public static String getPrefString(String key, final String defaultValue) {
        return settings.getString(key, defaultValue);
    }

    //传入键值对的字符串，存入内存


    public static void setPrefString(final String key, final String value) {
        settings.edit().putString(key, value).commit();
    }


    public static class DeviceBean implements Serializable {
        //设备mac地址
        private String mac;
        //设备名，若有备注名直接添加就行；
        private List<String> name;
        //有参构造
        public DeviceBean(String mac, List<String> name) {
            this.mac = mac;
            this.name = name;
        }

        public String getMac() {
            return mac;
        }

        public void setMac(String mac) {
            this.mac = mac;
        }

        public List<String> getName() {
            return name;
        }

        public void setName(List<String> name) {
            this.name = name;
        }
    }
}
